package com.jewel.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jewel.mapper.ProductMapper;
import com.jewel.pojo.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ProductServiceImpl implements IProductService {
    @Autowired
    private ProductMapper mapper;


    @Override
    public List<Product> list() {
        return mapper.selectList(new QueryWrapper<>());
    }

    @Override
    public Product getById(Integer id) {
        return mapper.selectById(id);
    }

    @Override
    public Integer add(Product product) {
        return mapper.insert(product);
    }

    @Override
    public Integer update(Product product) {
        return mapper.updateById(product);
    }

    @Override
    public Integer delete(Integer id) {
        return mapper.deleteById(id);
    }

}
